﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace Klient.Forms
{
    public partial class EmployeePage : PhoneApplicationPage, INotifyPropertyChanged
    {
        string id;
        
        public EmployeePage()
        {
            DataContext = this;
            InitializeComponent();
        }
        
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            NavigationContext.QueryString.TryGetValue("employeeID", out id);
            NavigationContext.QueryString.TryGetValue("employeeName", out empl);
            EmployeeName = empl;
        }

        string empl;
        public string EmployeeName
        {
            get
            {
                return empl;
            }
            set
            {
                empl = value;
                RaisePropertyChanged("EmployeeName");
            }
        }

        private void RaisePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void orders_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Forms/MyOrders.xaml?employeeID=" + id, UriKind.Relative));
        }

        private void customers_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Forms/MyCustomers.xaml?employeeID=" + id, UriKind.Relative));
        }
        
    }
}